const express = require('express')

const userRouter = require('./router/user')

const parseBody = require('./lib/parseBody')

const cors = require('./lib/cors.js')

const app = express()

// 处理一下跨域
app.use(cors.handleHeader)

//处理body数据，要放在路由之前
app.use(parseBody.handleData)
app.use('/api', userRouter)



app.listen(3002, (err) => {
    
    console.log('服务已经启动');
})